//
//  ABHomeNav.swift
//  hEhL
//
//  Created by 本 on 16/5/7.
//  Copyright © 2016年 本. All rights reserved.
//

import UIKit

class ABHomeNav: UINavigationController {
    override func loadView() {
        super.loadView()


        let barItem = UINavigationBar.appearance()
        barItem.setBackgroundImage(UIImage(named: "box_tool_header_background"), forBarMetrics: .Default)

    }
    
}
extension ABHomeNav {

    override func pushViewController(viewController: UIViewController, animated: Bool) {

        if self.childViewControllers.count > 0{
            let btn = UIButton(type: .Custom)
            btn.setTitle("haha", forState: .Normal)
            btn.sizeToFit()
            btn.addTarget(self, action: "back", forControlEvents: .TouchUpInside)
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: btn)
            
            let pan = UIPanGestureRecognizer(target: <#T##AnyObject?#>, action: <#T##Selector#>)
        
        }
        
        
        
        super.pushViewController(viewController, animated: animated)
    }
    func back (){
        self.popViewControllerAnimated(true)
    }

}
